home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4333 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  80 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: mozart.unx.sas.com!jamie
  3. From: jamie@cdevil.unx.sas.com (James Cooper)
  4. Subject: Re: FLOOD() questions
  5. Originator: jamie@cdevil.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <DnFzyp.DvL@unx.sas.com>
  8. Date: Tue, 27 Feb 1996 16:18:25 GMT
  9. X-Nntp-Posting-Host: cdevil.unx.sas.com
  10. References:  <19960223.7D2BD90.9087@mojaveg.ridgecrest.ca.us>
  11. Organization: SAS Institute Inc.
  12.  
  13.  
  14. In article <19960223.7D2BD90.9087@mojaveg.ridgecrest.ca.us>, mojaveg@ridgecrest.ca.us (Everett M. Greene) writes:
  15. >I've been experimenting with the Flood() graphics operation
  16. >and am finding much ambiguity in the RKM explanation.  I've
  17. >included an excerpt of the code I've tried (which doesn't
  18. >work).
  19. >
  20. >void do_window_magic(struct Window *wp)
  21. >{
  22. >  ULONG                        tmp_size;
  23. >  PLANEPTR             plane;
  24. >  struct TmpRas                tr;
  25. >
  26. >  tmp_size = RASSIZE(wp->Width, wp->Height) * wp->WScreen->BitMap.Depth;
  27. >  if (plane = AllocRaster(wp->Width, wp->Height)) {
  28. >    InitTmpRas(&tr, plane, tmp_size);
  29. >    wp->RPort->TmpRas = &tr;
  30. >    Flood(wp->RPort, 1, wp->BorderLeft + 1, wp->BorderTop + 1);
  31. >    FreeRaster(plane, wp->Width, wp->Height);
  32. >  }
  33. >}
  34.  
  35. Your code would be much simpler (and more correct!) if you used
  36. AllocBitmap() instead of AllocRaster().  AllocBitmap() is a 3.x
  37. only function, though.
  38.  
  39. By "more correct" I mean that everything will be allocated on
  40. proper boundaries, and with proper amounts of padding, etc.
  41.  
  42. Also, AllocBitmap() can allocate interleaved bitmaps, AllocRaster()
  43. (by definition, since it only allocates a single plane at a time)
  44. cannot.
  45.  
  46. >Questions:
  47. >
  48. >1. How does the size computed by RASSIZE compare to that
  49. >   generated by AllocRaster() from its width and height
  50. >   parameters?
  51.  
  52. AllocRaster() may round up to nearest 8 or 16 bit boundary.
  53. I don't remember if RASSIZE does or not.
  54.  
  55. >2. Does AllocRaster() allocate CHIP memory?
  56.  
  57. Yes.
  58.  
  59. >3. Do you have to AllocRaster() for each bit plane or will
  60. >   one allocation suffice for the whole temp raster?
  61.  
  62. You must do one for each plane.
  63.  
  64. >4. If one is flooding within a window, does the temp raster
  65. >   need to be any larger than the window?  [The RKM says
  66. >   something about making the temp raster the same size as
  67. >   the screen which would seem unnecessary.]
  68.  
  69. The temp raster needs to be as large as the area being flooded.
  70.  
  71. -- 
  72. ---------------
  73. Jim Cooper
  74. (jamie@unx.sas.com)                             bix: jcooper
  75.  
  76. Any opinions expressed herein are mine (Mine, all mine!  Ha, ha, ha!),
  77. and not necessarily those of my employer.
  78.  
  79. I'm NOT Politically Correct, but that's because I'm "Sensitivity Challenged."
  80.